<?php

$oper = $_POST['oper'];

if (!isset($oper))
{
	die("Unknown command");
}

require('../dbconnect.inc.php');

switch ($oper)
{

	case 'edit':
			$sth = $dbh->prepare('update groups set name=?, g_desc=? where g_id=?');
			$sth->execute(array($_POST['name'], $_POST['g_desc'], $_POST['id']));
		break;

	case 'add':
			$sth = $dbh->prepare('insert into groups (name, g_desc) values (?,?)');
			$sth->execute(array($_POST['name'], $_POST['g_desc']));
		break;

	case 'del':
			$sth = $dbh->prepare('delete from groups where g_id=?');
			$sth->execute(array($_POST['id']));
		break;

}

?>